package studentSort;

import java.util.Arrays;

public class Student {

    private String name;
    private int age;
    private int id;
    public Student(String name , int age,int id) {
        this.name = name;
        this.age = age;
        this.id = id;
    }
    public Student() {}

    public int getId() {
        return id;
    }

    public static void sort() {
        Student[] student = new Student[5];
        for (int i = 0; i < student.length - 1; i++) {
            for (int j = 0; j < student.length - 1 - i; j++) {
                if (student[j].getId() > student[j+1].getId()) {
                    Student temp = student[j];
                    student[j] = student[j+1];
                    student[j+1] = temp;
                }
            }
            System.out.println(Arrays.toString(student));
        }
    }

}
